package Demo;

import java.util.concurrent.*;

public class Test {
    public static void main(String[] args) {
        ExecutorService service = Executors.newFixedThreadPool(10);

        ExecutorService service2 = Executors.newCachedThreadPool();

        ExecutorService service3 = Executors.newSingleThreadExecutor();

        ExecutorService service4 = Executors.newScheduledThreadPool(10);

//        ThreadPoolExecutor executor = new ThreadPoolExecutor(
//                5,      // 核心线程数
//                10,     // 最大线程数
//                60,     // 空闲线程存活时间
//                TimeUnit.SECONDS, // 时间单位
//                new LinkedBlockingQueue<>(100) // 工作队列
//        );
//
//        ThreadPoolExecutor executor2 = new ThreadPoolExecutor(10,15
//                ,60,TimeUnit.SECONDS,new SynchronousQueue<>())

       for (int i = 0; i < 100; i++) {
           int Id = i;
           service.submit(new Runnable() {
               @Override
               public void run() {
                   System.out.println("Hello World: " + Id);
               }
           });
       }





    }
}
